/* eslint-disable */
import "./main";
import { h } from 'vue'
/**
 *
 */
export default {
  /**
   * 安装
   */
  install(Vue, options) {
    // 注册全局组件
    Vue.component("dmap", this);
    // 混入
    // Vue.mixin({});
  },
  render: () => {
    return h('div', {
      style: 'height:100%'
    })
  },
  /**
   * props
   */
  props: {
    /**
     * 地图平台
     */
    platform: {
      default: "leaflet"
    }
  },
  /**
   * 挂载
   */
  mounted() {
    let prefix = "dmap";
    let {
      platform,
      $attrs,
      $el,
      $parent,
      $root
    } = this;
    //
    T.require([`./${prefix}/${platform}/${prefix}-${platform}`], L => {
      let options = T.assign({}, $root.$options.mapOptions, $attrs);
      this.$emit("pre-init", options);
      //
      L = L.default || L;
      let map = (this.map = L.map($el, options));
      if (!$parent.map) {
        $parent.map = map;
        // $parent.dmap = {leaflet,arcgis,cesium}
      }
      this.$emit("init", map);
    });
  }
};